---动作基类，该类只实现一些该动作的数据标志

---@class ActionBase
---@field label string  标签
---@field cost number   花费
---@field priority number   优先级
---@field interruptible boolean 当前动作是否可被打断
---@field canInterruptiblePlan boolean  是否可打断计划
---@field preconditions State   先决条件
---@field effects State 造成的影响
---@field agent AgentBase 代理
---@field base ActionBase
ActionBase = class()

function ActionBase:ctor(agent,...)
    self.base = ActionBase;
    self.agent = agent;
    self.preconditions = self:InitPreconditions();
    if self.preconditions == nil then
        Debug.LogError("动作的先决条件出现空！")
    end
    self.effects = self:InitEffects();
    if self.effects == nil then
        Debug.LogError("动作的影响出现空！")
    end
    self.label = self:GetLabel();
    if self.label == nil or self.label == "" then
        Debug.LogError("动作的标签出现空！")
    end
    self.cost = self:GetCost();
    self.priority = self:GetPriority();
    self.interruptible = self:GetInterruptible();
    self.canInterruptiblePlan = self:GetCanInterruptiblePlan();
end

---获取标签，子类重写
function ActionBase:GetLabel() return "" end

---获取花费，子类重写
function ActionBase:GetCost() return 0 end

---获取优先级，子类重写
function ActionBase:GetPriority() return 0 end

---获取动作是否可被打断，子类重写
function ActionBase:GetInterruptible() return false; end

---获取可否打断计划，子类重写
function ActionBase:GetCanInterruptiblePlan() return false; end

---初始化先决条件，由子类实现
---@return State
function ActionBase:InitPreconditions()
    local state = State.new();
    return state;
end

---初始化动作产生的影响，由子类实现
---@return State
function ActionBase:InitEffects()
    local state = State.new();
    return state;
end

---验证先决条件
function ActionBase:VerifyPreconditions()
    return self.agent.agentState:ContainState(self.preconditions);
end

function ActionBase:Release()

end